#pragma once

#ifndef __LIT__CACHE__MANAGER__INCLUDED__HH__
#define __LIT__CACHE__MANAGER__INCLUDED__HH__

#include <LitCoreComponent.h>
#include <LitFileSystem.h>
#include <LitCacheTypes.h>

namespace Lit
{
	class LIT_API CacheManager : public CoreComponent
	{
		std::string mBasePath;
	public:
		CacheManager();
		~CacheManager();

		bool isFileCached( const std::string &name, CacheLocation loc, const std::string &subdir = "" ) const;
		Ogre::Image getCachedImage( const std::string &name, CacheLocation loc, const std::string &subdir = "" ) const;
		FilePath getCachePath( const std::string &name, CacheLocation loc, const std::string &subdir ) const;
		FilePath getLocationPath( CacheLocation loc, const std::string &subdir = "" ) const;
		
		RefPtr<FileStream> openCachedResource( const std::string &name, bool binary, CacheLocation loc, const std::string &subdir = "" ) const;
		RefPtr<FileStream> createCachedResource( const std::string &name, bool binary, CacheLocation loc, const std::string &subdir = "" ) const;
		virtual void initialise(OgreRenderWindowPtr win, OgreCameraPtr cam, OgreSceneManagerPtr mgr );
		virtual void shutdown();
	};
};

#endif